package com.ceba.test.base.web;

import javax.servlet.http.HttpServletRequest;


import abc.web.SessionUtils;
import abc.user.IUser;

public class UserUtils {
	
	
	public static String getUserId(HttpServletRequest request){
		IUser user = SessionUtils.getUserInfo(request);
		if(user != null){
			return (String) user.getId();
		}
		return null;
	}
	
	public static IUser getLoginUser(HttpServletRequest request){
		return SessionUtils.getUserInfo(request);
	}
	
	public static String getUserRole(HttpServletRequest request){
		IUser user = SessionUtils.getUserInfo(request);
		if(user != null){
			return (String) user.get("ROLE");
		}
		return null;
	}

	public static String getUserName(HttpServletRequest request){
		IUser user = SessionUtils.getUserInfo(request);
		if(user != null){
			return (String) user.getName();
		}
		return null;
	}
	
	
}
